import requests
import kuser_agent as kua
import lxml.etree as le


content = requests.get(
    url ='https://search.51job.com/list/000000,000000,0000,00,9,99,%25E6%2595%25B0%25E6%258D%25AE%25E5%2588%2586%25E6%259E%2590,2,1.html?lang=c&postchannel=0000&workyear=99&cotype=99&degreefrom=99&jobterm=99&companysize=99&ord_field=0&dibiaoid=0&line=&welfare=',
    headers ={
        'User-Agent':kua.get()
    }
).content


with open('1级页面.html','wb') as f:
    f.write(content)
contentx = le.HTML(content)


#该xpath在页面有内容，提取后打印却为空
job_names = contentx.xpath('//span[@class="jname at"]/text()')
print(job_names)   #---------------[].
# 发现在'1级页面.html'页面中没有“jname at”，可知js动态添加数据



